import { COMMON_PARAMS } from './config'
import jsonp from 'common/js/jsonp'

export function getSingerList() {
  const url = 'https://c.y.qq.com/v8/fcg-bin/v8.fcg';

  const data = Object.assign({}, COMMON_PARAMS, {
    channel: 'singer',
    page: 'list',
    key: 'all_all_all',
    pagesize: 100,
    pagenum: 1,
    g_tk: 162794504
  })

  return jsonp(url, data, {
    param: 'jsonpCallback',
    prefix: 'GetSingerListCallback'
  });
}

export function getSingerDetail(singerId) {
  const url = 'https://c.y.qq.com/v8/fcg-bin/fcg_v8_singer_track_cp.fcg';
  const data = Object.assign({}, COMMON_PARAMS, {
    g_tk: 5381,
    singermid: singerId,
    order: 'listen',
    begin: 0,
    num: 100,
    songstatus: 1
  })

  return jsonp(url, data, {
    param: 'jsonpCallback',
    prefix: 'MusicJsonCallbacksinger_track'
  });
}